package method.homework1203;
//打印二维数组里面每一个小数组里数据的和， 以及二维数组里面所有int数的和。
//int[][] arr = {{1,2,3},{6,7,8,5,6,8},{3,4,5,6,7,8,9}};
public class work06 {
    public static void main(String[] args) {
        int[][] arr = {{1,2,3},{6,7,8,5,6,8},{3,4,5,6,7,8,9}};
        int count=0;
        int sum=0;
        int k=0;
        int m=0;
        for (int i = 0; i < arr[0].length; i++) {
            count+=arr[0][i];
        }
        System.out.println("第一个数组的和为："+count);
        for (int i = 0; i < arr[1].length; i++) {
            sum+=arr[1][i];
        }
        System.out.println("第二个数组的和为："+sum);
        for (int i = 0; i < arr[2].length; i++) {
            k+=arr[2][i];
        }
        System.out.println("第三个数组的和为："+k);
        for (int j = 0; j < arr.length; j++) {
            for (int i = 0; i < arr[j].length; i++) {
                m+=arr[j][i];
            }
        }
        System.out.println("整个数组的和为："+m);
    }
}
